package com.itcast.demo.validate.pojo;

import jakarta.validation.GroupSequence;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * @author SuQianLong
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class UserGroupSequence {
    public interface GroupA {}
    public interface GroupB {}
    // 定义验证分组接口和顺序
    @GroupSequence({GroupA.class, GroupB.class})
    public interface MyValidationGroupSequence {}



    @NotBlank(message = "用户ID不能为空", groups = {GroupB.class})
    private String userId;
    @NotBlank(message = "用户名不能为空", groups = {GroupA.class, GroupB.class})
    private String name;
    @Email(message = "邮箱格式不正确", groups = {GroupB.class})
    private String email;



}

